<?php
if (!(defined('IN_IA'))) {	exit('Access Denied');}class Index_Page extends WebPage{	public function slide(){        global $_W,$_GPC;        $uniacid=$_W['uniacid'];
        $pindex = max(1, intval($_GPC['page']));        $psize = 8;        $list=pdo_fetchall("select * from ".tablename('bd_cms_ad')." where `uniacid`='$uniacid' order by ad_id desc LIMIT " . ($pindex - 1) * $psize . ",{$psize}");        $total = pdo_fetchcolumn("select count(*) from ".tablename('bd_cms_ad')." where `uniacid`='$uniacid' order by ad_id desc");        $pager = pagination($total, $pindex, $psize);        $i = ($pindex - 1) * $psize+1;        include $this->template();    }
    /*    * 添加幻灯片     */		public function slide_add(){			global $_W,$_GPC;			$_W['page']['title'] = '添加轮播';			$uniacid=$_W['uniacid'];			if($_W['ispost']){				$data=array();	            $data['ad_title']=$_GPC['ad_title'];	            $data['ad_thumb']=$_GPC['ad_thumb'];	            $data['ad_content']=$_GPC['ad_content'];	            $data['is_show']=$_GPC['is_show'];	            $data['uid']=$_W['uid'];	            $data['uniacid']=$_W['uniacid'];	            $data['add_time']=date('Y-m-d H:i:s');	            $data['last_time']=date('Y-m-d H:i:s');	            $res=pdo_insert('bd_cms_ad',$data);	            if(!empty($_GPC['jixu'])){	            	$this->success('添加成功','',2);	            }else{	            	$this->success('添加成功','slide/index/slide');	            }			}			include $this->template();		}
    /*    * 修改幻灯片     */
    public function slide_edit(){
		global $_W,$_GPC;		$_W['page']['title'] = '修改轮播';		$uniacid=$_W['uniacid'];		$id=$_GPC['ad_id'];		$ad=pdo_get('bd_cms_ad',array('ad_id'=>$id));		if($_W['ispost']){			$data=array();            $data['ad_title']=$_GPC['ad_title'];            $data['ad_thumb']=$_GPC['ad_thumb'];            $data['ad_content']=$_GPC['ad_content'];            $data['is_show']=$_GPC['is_show'];            $data['uid']=$_W['uid'];            $data['uniacid']=$_W['uniacid'];            $data['add_time']=date('Y-m-d H:i:s');            $data['last_time']=date('Y-m-d H:i:s');            $res=pdo_update('bd_cms_ad',$data,array('ad_id'=>$id));            if($res){            	$this->success('修改成功','slide/index/slide');            }else{            	$this->error('修改失败');            }		}		include $this->template();
    }
    /*    * 删除幻灯片     */
    public function slide_del(){
        global $_W,$_GPC;        $uniacid=$_W['uniacid'];        if($_GPC['ad_id']){            $id=$_GPC['ad_id'];            $res=pdo_delete('bd_cms_ad',array('ad_id'=>$id,'uniacid'=>$uniacid));        }        if($res){        	$this->success('删除成功','slide/index/slide');        }else{        	$this->error('删除失败');        }    }
}
?>